
package com.ami.kvm.jviewer.soc;

import com.ami.kvm.jviewer.common.ISOCMenu;
import com.ami.kvm.jviewer.gui.JVMenu;
import com.ami.kvm.jviewer.gui.LocaleStrings;
import java.util.Hashtable;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JSeparator;

public class SOCMenu extends JVMenu implements ISOCMenu {
	public static final String VIDEO_COMPRESSION_MODE = "Compression Mode";
	public static final String VIDEO_COMPRESSION_YUV_420 = "YUV_420";
	public static final String VIDEO_COMPRESSION_YUV_444 = "YUV_444";
	public static final String VIDEO_COMPRESSION_YUV_444_2_COLORS_VQ = "YUV_444_2_COLORS_VQ";
	public static final String VIDEO_COMPRESSION_YUV_444_4_COLORS_VQ = "YUV_444_4_COLORS_VQ";
	public static final String VIDEO_DCT_QUANTIZATION_TABLE = "DCT Quantization Table";
	public static final String VIDEO_DCT_QUANTIZATION_TABLE_0 = "DCT_Table_0";
	public static final String VIDEO_DCT_QUANTIZATION_TABLE_1 = "DCT_Table_1";
	public static final String VIDEO_DCT_QUANTIZATION_TABLE_2 = "DCT_Table_2";
	public static final String VIDEO_DCT_QUANTIZATION_TABLE_3 = "DCT_Table_3";
	public static final String VIDEO_DCT_QUANTIZATION_TABLE_4 = "DCT_Table_4";
	public static final String VIDEO_DCT_QUANTIZATION_TABLE_5 = "DCT_Table_5";
	public static final String VIDEO_DCT_QUANTIZATION_TABLE_6 = "DCT_Table_6";
	public static final String VIDEO_DCT_QUANTIZATION_TABLE_7 = "DCT_Table_7";
	private Hashtable<String, JMenuItem> menuItemTable;
	private Hashtable<String, JMenu> menuTable;

	public void SetSOCMenuItem(Hashtable<String, JMenuItem> paramHashtable) {
		this.menuItemTable = paramHashtable;
	}

	public void SetSOCMenu(Hashtable<String, JMenu> paramHashtable) {
		this.menuTable = paramHashtable;
	}

	public void constructsocMenu(JMenuBar paramJMenuBar) {
		int i = ((JMenu) this.menuTable.get("Video")).getItemCount();
		((JMenu) this.menuTable.get("Video")).add(AddCompressinModeSubMenu(), i - 1);
		((JMenu) this.menuTable.get("Video")).add(AddDCTQuantizationTableSubMenu(), i);
		((JMenu) this.menuTable.get("Video")).add(new JSeparator(), i + 1);
	}

	public void constructsocMenu(JPopupMenu paramJPopupMenu) {
		int i = ((JMenu) this.menuTable.get("Video")).getItemCount();
		((JMenu) this.menuTable.get("Video")).add(AddCompressinModeSubMenu(), i - 1);
		((JMenu) this.menuTable.get("Video")).add(AddDCTQuantizationTableSubMenu(), i);
		((JMenu) this.menuTable.get("Video")).add(new JSeparator(), i + 1);
	}

	private JMenu AddCompressinModeSubMenu() {
		ButtonGroup localButtonGroup = new ButtonGroup();

		JMenu localJMenu = new JMenu(LocaleStrings.getSOCString("1_3_SOCM"));
		localJMenu.addMouseListener(m_menuStatus);
		m_menustatusbar_text.put("Compression Mode", LocaleStrings.getSOCString("1_3_SOCM"));
		this.menuTable.put("Compression Mode", localJMenu);

		JRadioButtonMenuItem localJRadioButtonMenuItem = new JRadioButtonMenuItem("YUV 420");
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("YUV_420");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("YUV_420", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("YUV_420", LocaleStrings.getSOCString("1_4_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("YUV_420", Boolean.valueOf(false));
			m_menuItems_setenabled.put("YUV_420", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem("YUV 444");
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("YUV_444");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("YUV_444", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("YUV_444", LocaleStrings.getSOCString("1_5_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("YUV_444", Boolean.valueOf(false));
			m_menuItems_setenabled.put("YUV_444", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem(LocaleStrings.getSOCString("1_6_SOCM"));
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("YUV_444_2_COLORS_VQ");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("YUV_444_2_COLORS_VQ", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("YUV_444_2_COLORS_VQ", LocaleStrings.getSOCString("1_7_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("YUV_444_2_COLORS_VQ", Boolean.valueOf(false));
			m_menuItems_setenabled.put("YUV_444_2_COLORS_VQ", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem(LocaleStrings.getSOCString("1_8_SOCM"));
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("YUV_444_4_COLORS_VQ");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("YUV_444_4_COLORS_VQ", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("YUV_444_4_COLORS_VQ", LocaleStrings.getSOCString("1_9_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("YUV_444_4_COLORS_VQ", Boolean.valueOf(false));
			m_menuItems_setenabled.put("YUV_444_4_COLORS_VQ", Boolean.valueOf(true));
		}

		return localJMenu;
	}

	private JMenu AddDCTQuantizationTableSubMenu() {
		ButtonGroup localButtonGroup = new ButtonGroup();

		JMenu localJMenu = new JMenu(LocaleStrings.getSOCString("1_10_SOCM"));
		localJMenu.addMouseListener(m_menuStatus);
		m_menustatusbar_text.put("DCT Quantization Table", LocaleStrings.getSOCString("1_10_SOCM"));
		this.menuTable.put("DCT Quantization Table", localJMenu);

		JRadioButtonMenuItem localJRadioButtonMenuItem = new JRadioButtonMenuItem(
				LocaleStrings.getSOCString("1_19_SOCM"));
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("DCT_Table_0");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("DCT_Table_0", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("DCT_Table_0", LocaleStrings.getSOCString("1_11_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("DCT_Table_0", Boolean.valueOf(false));
			m_menuItems_setenabled.put("DCT_Table_0", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem("1");
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("DCT_Table_1");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("DCT_Table_1", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("DCT_Table_1", LocaleStrings.getSOCString("1_12_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("DCT_Table_1", Boolean.valueOf(false));
			m_menuItems_setenabled.put("DCT_Table_1", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem("2");
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("DCT_Table_2");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("DCT_Table_2", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("DCT_Table_2", LocaleStrings.getSOCString("1_13_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("DCT_Table_2", Boolean.valueOf(false));
			m_menuItems_setenabled.put("DCT_Table_2", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem("3");
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("DCT_Table_3");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("DCT_Table_3", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("DCT_Table_3", LocaleStrings.getSOCString("1_14_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("DCT_Table_3", Boolean.valueOf(false));
			m_menuItems_setenabled.put("DCT_Table_3", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem("4");
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("DCT_Table_4");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("DCT_Table_4", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("DCT_Table_4", LocaleStrings.getSOCString("1_15_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("DCT_Table_4", Boolean.valueOf(false));
			m_menuItems_setenabled.put("DCT_Table_4", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem("5");
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("DCT_Table_5");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("DCT_Table_5", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("DCT_Table_5", LocaleStrings.getSOCString("1_16_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("DCT_Table_5", Boolean.valueOf(false));
			m_menuItems_setenabled.put("DCT_Table_5", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem("6");
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("DCT_Table_6");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("DCT_Table_6", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("DCT_Table_6", LocaleStrings.getSOCString("1_17_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("DCT_Table_6", Boolean.valueOf(false));
			m_menuItems_setenabled.put("DCT_Table_6", Boolean.valueOf(true));
		}

		localJRadioButtonMenuItem = new JRadioButtonMenuItem(LocaleStrings.getSOCString("1_20_SOCM"));
		localJRadioButtonMenuItem.addActionListener(this.m_menuListener);
		localJRadioButtonMenuItem.addMouseListener(m_menuStatus);
		localJRadioButtonMenuItem.setActionCommand("DCT_Table_7");
		localButtonGroup.add(localJRadioButtonMenuItem);
		localJMenu.add(localJRadioButtonMenuItem);

		this.menuItemTable.put("DCT_Table_7", localJRadioButtonMenuItem);
		m_menustatusbar_text.put("DCT_Table_7", LocaleStrings.getSOCString("1_18_SOCM"));
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put("DCT_Table_7", Boolean.valueOf(false));
			m_menuItems_setenabled.put("DCT_Table_7", Boolean.valueOf(true));
		}

		return localJMenu;
	}

	private JCheckBoxMenuItem createCheckBoxMenuItem(String paramString1, String paramString2, String paramString3) {
		JCheckBoxMenuItem localJCheckBoxMenuItem = new JCheckBoxMenuItem(paramString1);

		localJCheckBoxMenuItem.addActionListener(this.m_menuListener);
		localJCheckBoxMenuItem.addMouseListener(m_menuStatus);
		localJCheckBoxMenuItem.setActionCommand(paramString2);
		this.menuItemTable.put(paramString2, localJCheckBoxMenuItem);
		m_menustatusbar_text.put(paramString2, paramString3);
		if (INITIAL_MENU_STATUS) {
			m_menuItems_setselected.put(paramString2, Boolean.valueOf(false));
			m_menuItems_setenabled.put(paramString2, Boolean.valueOf(true));
		}

		return localJCheckBoxMenuItem;
	}

	public void initKVMPartialExceptionSOCMenuItems() {
		KVMPartialExceptionSOCMenuItems = new String[0];
	}
}
